/*
 * @Author: Wangjun
 * @Date: 2023-08-14 13:47:00
 * @LastEditTime: 2023-12-01 17:18:12
 * @LastEditors: Please set LastEditors
 * @Description: 
 * @FilePath: \drawing\vite.config.ts
 * hnxr
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
    resolve: {
        // 配置路径别名
        alias: {
            '@': path.resolve(__dirname, './src'),
        },
    },
    plugins: [
        vue()
    ], server: {
        proxy: { //配置多个跨域
            "/v1": {
                target: "http://127.0.0.1:8080",
                changeOrigin: true,
                // rewrite: (path) => path.replace(/^\/api/, ""),
                // rewrite: path => {
                //   // console.log(path); // 打印[/api/userInfo] 这就是http-proxy要请求的url,我们基地址实际是没有/api 所以replace掉
                //   return path.replace(/^\/api/, '');
                // }
            }
        }
    },
    base: '/static/node/',
})
